<?php
namespace Home\Controller;
use Think\Controller;
class ModPwdController extends Controller {
    public function modPwd(){
//         $admin=M("tb_admin");
//         $user=$admin->
//         $this->assign($name)
        $this->display();
    }
    
    
    public function doModPwd() {
       
        $name = $_POST['name'];
        $opwd = md5($_POST['opwd']);
        $npwd = md5($_POST['npwd']);
        $rpwd = md5($_POST['rpwd']);
       
        
        if ($npwd!=$rpwd){
            echo 2;            
        }else{
            $admin = M('admin');
            $where['admin_user'] = array(
                'eq',
                $name
            );
            $where['admin_pass'] = array(
                'eq',
                $opwd
            );
            $list = $admin->where($where)->find();
            if(count($list)<=0){
                echo 3;
            }elseif (count($list)==1){
                $data["admin_pass"]=
                $list = $admin->where($where)->save($data)
                echo 1;
            }
        }
    }
}